home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / number / frmsmfti.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-07-27  |  20.5 KB  |  606 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSMFTicTacToe 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Smoke Tic-Tac-Toe"
  5.    ClientHeight    =   4455
  6.    ClientLeft      =   2730
  7.    ClientTop       =   2040
  8.    ClientWidth     =   6675
  9.    Icon            =   "FrmSMFTicTacToe.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    MousePointer    =   15  'Size All
  14.    ScaleHeight     =   4455
  15.    ScaleWidth      =   6675
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.CommandButton Command1 
  18.       Caption         =   "E&xit"
  19.       Height          =   375
  20.       Left            =   2760
  21.       TabIndex        =   2
  22.       Top             =   3840
  23.       Width           =   855
  24.    End
  25.    Begin VB.CommandButton cmdPlayAgain 
  26.       Caption         =   "&Play Again"
  27.       Height          =   375
  28.       Left            =   840
  29.       TabIndex        =   0
  30.       Top             =   3840
  31.       Width           =   1575
  32.    End
  33.    Begin VB.Timer Timer1 
  34.       Interval        =   1
  35.       Left            =   120
  36.       Top             =   3120
  37.    End
  38.    Begin VB.Label box9 
  39.       Alignment       =   2  'Center
  40.       BeginProperty Font 
  41.          Name            =   "Arial"
  42.          Size            =   35.25
  43.          Charset         =   0
  44.          Weight          =   400
  45.          Underline       =   0   'False
  46.          Italic          =   0   'False
  47.          Strikethrough   =   0   'False
  48.       EndProperty
  49.       Height          =   975
  50.       Left            =   3120
  51.       TabIndex        =   15
  52.       Top             =   2640
  53.       Width           =   1215
  54.    End
  55.    Begin VB.Label box8 
  56.       Alignment       =   2  'Center
  57.       BeginProperty Font 
  58.          Name            =   "Arial"
  59.          Size            =   35.25
  60.          Charset         =   0
  61.          Weight          =   400
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       Height          =   975
  67.       Left            =   1680
  68.       TabIndex        =   14
  69.       Top             =   2640
  70.       Width           =   1215
  71.    End
  72.    Begin VB.Label box7 
  73.       Alignment       =   2  'Center
  74.       BeginProperty Font 
  75.          Name            =   "Arial"
  76.          Size            =   35.25
  77.          Charset         =   0
  78.          Weight          =   400
  79.          Underline       =   0   'False
  80.          Italic          =   0   'False
  81.          Strikethrough   =   0   'False
  82.       EndProperty
  83.       Height          =   975
  84.       Left            =   240
  85.       TabIndex        =   13
  86.       Top             =   2640
  87.       Width           =   1215
  88.    End
  89.    Begin VB.Label box6 
  90.       Alignment       =   2  'Center
  91.       BeginProperty Font 
  92.          Name            =   "Arial"
  93.          Size            =   35.25
  94.          Charset         =   0
  95.          Weight          =   400
  96.          Underline       =   0   'False
  97.          Italic          =   0   'False
  98.          Strikethrough   =   0   'False
  99.       EndProperty
  100.       Height          =   975
  101.       Left            =   3120
  102.       TabIndex        =   12
  103.       Top             =   1440
  104.       Width           =   1215
  105.    End
  106.    Begin VB.Label box4 
  107.       Alignment       =   2  'Center
  108.       BeginProperty Font 
  109.          Name            =   "Arial"
  110.          Size            =   35.25
  111.          Charset         =   0
  112.          Weight          =   400
  113.          Underline       =   0   'False
  114.          Italic          =   0   'False
  115.          Strikethrough   =   0   'False
  116.       EndProperty
  117.       Height          =   975
  118.       Left            =   240
  119.       TabIndex        =   10
  120.       Top             =   1440
  121.       Width           =   1215
  122.    End
  123.    Begin VB.Label box3 
  124.       Alignment       =   2  'Center
  125.       BeginProperty Font 
  126.          Name            =   "Arial"
  127.          Size            =   35.25
  128.          Charset         =   0
  129.          Weight          =   400
  130.          Underline       =   0   'False
  131.          Italic          =   0   'False
  132.          Strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   975
  135.       Left            =   3120
  136.       TabIndex        =   9
  137.       Top             =   240
  138.       Width           =   1215
  139.    End
  140.    Begin VB.Label box2 
  141.       Alignment       =   2  'Center
  142.       BeginProperty Font 
  143.          Name            =   "Arial"
  144.          Size            =   35.25
  145.          Charset         =   0
  146.          Weight          =   400
  147.          Underline       =   0   'False
  148.          Italic          =   0   'False
  149.          Strikethrough   =   0   'False
  150.       EndProperty
  151.       Height          =   975
  152.       Left            =   1680
  153.       TabIndex        =   8
  154.       Top             =   240
  155.       Width           =   1215
  156.    End
  157.    Begin VB.Label box1 
  158.       Alignment       =   2  'Center
  159.       BeginProperty Font 
  160.          Name            =   "Arial"
  161.          Size            =   35.25
  162.          Charset         =   0
  163.          Weight          =   400
  164.          Underline       =   0   'False
  165.          Italic          =   0   'False
  166.          Strikethrough   =   0   'False
  167.       EndProperty
  168.       Height          =   975
  169.       Left            =   240
  170.       TabIndex        =   7
  171.       Top             =   240
  172.       Width           =   1215
  173.    End
  174.    Begin VB.Label lblPlayer2points 
  175.       Alignment       =   2  'Center
  176.       BeginProperty Font 
  177.          Name            =   "Arial"
  178.          Size            =   24
  179.          Charset         =   0
  180.          Weight          =   400
  181.          Underline       =   0   'False
  182.          Italic          =   0   'False
  183.          Strikethrough   =   0   'False
  184.       EndProperty
  185.       ForeColor       =   &H00FF0000&
  186.       Height          =   615
  187.       Left            =   5040
  188.       TabIndex        =   6
  189.       Top             =   2880
  190.       Width           =   735
  191.    End
  192.    Begin VB.Label lblPlayer1points 
  193.       Alignment       =   2  'Center
  194.       BeginProperty Font 
  195.          Name            =   "Arial"
  196.          Size            =   24
  197.          Charset         =   0
  198.          Weight          =   400
  199.          Underline       =   0   'False
  200.          Italic          =   0   'False
  201.          Strikethrough   =   0   'False
  202.       EndProperty
  203.       ForeColor       =   &H000000FF&
  204.       Height          =   615
  205.       Left            =   5040
  206.       TabIndex        =   5
  207.       Top             =   1440
  208.       Width           =   735
  209.    End
  210.    Begin VB.Label Label3 
  211.       Caption         =   "Player 2"
  212.       BeginProperty Font 
  213.          Name            =   "Arial"
  214.          Size            =   24
  215.          Charset         =   0
  216.          Weight          =   400
  217.          Underline       =   0   'False
  218.          Italic          =   0   'False
  219.          Strikethrough   =   0   'False
  220.       EndProperty
  221.       ForeColor       =   &H00FF0000&
  222.       Height          =   615
  223.       Left            =   4560
  224.       TabIndex        =   4
  225.       Top             =   2160
  226.       Width           =   1815
  227.    End
  228.    Begin VB.Label Label2 
  229.       Caption         =   "Player 1"
  230.       BeginProperty Font 
  231.          Name            =   "Arial"
  232.          Size            =   24
  233.          Charset         =   0
  234.          Weight          =   400
  235.          Underline       =   0   'False
  236.          Italic          =   0   'False
  237.          Strikethrough   =   0   'False
  238.       EndProperty
  239.       ForeColor       =   &H000000FF&
  240.       Height          =   495
  241.       Left            =   4560
  242.       TabIndex        =   3
  243.       Top             =   720
  244.       Width           =   1815
  245.    End
  246.    Begin VB.Label Label1 
  247.       Caption         =   "TIE"
  248.       BeginProperty Font 
  249.          Name            =   "Arial"
  250.          Size            =   24
  251.          Charset         =   0
  252.          Weight          =   400
  253.          Underline       =   0   'False
  254.          Italic          =   0   'False
  255.          Strikethrough   =   0   'False
  256.       EndProperty
  257.       ForeColor       =   &H00000000&
  258.       Height          =   495
  259.       Left            =   1920
  260.       TabIndex        =   1
  261.       Top             =   1680
  262.       Visible         =   0   'False
  263.       Width           =   855
  264.    End
  265.    Begin VB.Line Line4 
  266.       BorderColor     =   &H00000000&
  267.       BorderWidth     =   5
  268.       X1              =   120
  269.       X2              =   4320
  270.       Y1              =   2520
  271.       Y2              =   2520
  272.    End
  273.    Begin VB.Line Line3 
  274.       BorderColor     =   &H00000000&
  275.       BorderWidth     =   5
  276.       X1              =   120
  277.       X2              =   4320
  278.       Y1              =   1320
  279.       Y2              =   1320
  280.    End
  281.    Begin VB.Line Line2 
  282.       BorderColor     =   &H00000000&
  283.       BorderWidth     =   5
  284.       X1              =   3000
  285.       X2              =   3000
  286.       Y1              =   240
  287.       Y2              =   3600
  288.    End
  289.    Begin VB.Line Line1 
  290.       BorderColor     =   &H00000000&
  291.       BorderWidth     =   5
  292.       X1              =   1560
  293.       X2              =   1560
  294.       Y1              =   240
  295.       Y2              =   3600
  296.    End
  297.    Begin VB.Label box5 
  298.       Alignment       =   2  'Center
  299.       BeginProperty Font 
  300.          Name            =   "Arial"
  301.          Size            =   35.25
  302.          Charset         =   0
  303.          Weight          =   400
  304.          Underline       =   0   'False
  305.          Italic          =   0   'False
  306.          Strikethrough   =   0   'False
  307.       EndProperty
  308.       Height          =   975
  309.       Left            =   1680
  310.       TabIndex        =   11
  311.       Top             =   1440
  312.       Width           =   1215
  313.    End
  314. Attribute VB_Name = "frmSMFTicTacToe"
  315. Attribute VB_GlobalNameSpace = False
  316. Attribute VB_Creatable = False
  317. Attribute VB_PredeclaredId = True
  318. Attribute VB_Exposed = False
  319. Option Explicit
  320. Dim player1points As Integer
  321. Dim player2points As Integer
  322. Private Sub box1_Click()
  323. If box1.Caption = "" And MousePointer = 15 Then
  324.     box1.Caption = "X"
  325.     MousePointer = 12
  326. End If
  327. If box1.Caption = "" And MousePointer = 12 Then
  328.     box1.Caption = "O"
  329.     MousePointer = 15
  330.     End If
  331. End Sub
  332. Private Sub Box2_Click()
  333. If box2.Caption = "" And MousePointer = 15 Then
  334.     box2.Caption = "X"
  335.     MousePointer = 12
  336. End If
  337. If box2.Caption = "" And MousePointer = 12 Then
  338.     box2.Caption = "O"
  339.     MousePointer = 15
  340.     End If
  341. End Sub
  342. Private Sub Box3_Click()
  343. If box3.Caption = "" And MousePointer = 15 Then
  344.     box3.Caption = "X"
  345.     MousePointer = 12
  346. End If
  347. If box3.Caption = "" And MousePointer = 12 Then
  348.     box3.Caption = "O"
  349.     MousePointer = 15
  350.     End If
  351. End Sub
  352. Private Sub box4_Click()
  353. If box4.Caption = "" And MousePointer = 15 Then
  354.     box4.Caption = "X"
  355.     MousePointer = 12
  356. End If
  357. If box4.Caption = "" And MousePointer = 12 Then
  358.     box4.Caption = "O"
  359.     MousePointer = 15
  360.     End If
  361. End Sub
  362. Private Sub Box5_Click()
  363. If box5.Caption = "" And MousePointer = 15 Then
  364.     box5.Caption = "X"
  365.     MousePointer = 12
  366. End If
  367. If box5.Caption = "" And MousePointer = 12 Then
  368.     box5.Caption = "O"
  369.     MousePointer = 15
  370.     End If
  371. End Sub
  372. Private Sub box6_Click()
  373. If box6.Caption = "" And MousePointer = 15 Then
  374.     box6.Caption = "X"
  375.     MousePointer = 12
  376. End If
  377. If box6.Caption = "" And MousePointer = 12 Then
  378.     box6.Caption = "O"
  379.     MousePointer = 15
  380.     End If
  381. End Sub
  382. Private Sub Box7_Click()
  383. If box7.Caption = "" And MousePointer = 15 Then
  384.     box7.Caption = "X"
  385.     MousePointer = 12
  386. End If
  387. If box7.Caption = "" And MousePointer = 12 Then
  388.     box7.Caption = "O"
  389.     MousePointer = 15
  390.     End If
  391. End Sub
  392. Private Sub Box8_Click()
  393. If box8.Caption = "" And MousePointer = 15 Then
  394.     box8.Caption = "X"
  395.     MousePointer = 12
  396. End If
  397. If box8.Caption = "" And MousePointer = 12 Then
  398.     box8.Caption = "O"
  399.     MousePointer = 15
  400.     End If
  401. End Sub
  402. Private Sub Box9_Click()
  403. If box9.Caption = "" And MousePointer = 15 Then
  404.     box9.Caption = "X"
  405.     MousePointer = 12
  406. End If
  407. If box9.Caption = "" And MousePointer = 12 Then
  408.     box9.Caption = "O"
  409.     MousePointer = 15
  410.     End If
  411. End Sub
  412. Private Sub Command1_Click()
  413. End Sub
  414. Private Sub cmdPlayAgain_Click()
  415. Timer1.Interval = 1
  416.     box1.Visible = True
  417.     box2.Visible = True
  418.     box3.Visible = True
  419.     box4.Visible = True
  420.     box5.Visible = True
  421.     box6.Visible = True
  422.     box7.Visible = True
  423.     box8.Visible = True
  424.     box9.Visible = True
  425.     Line1.Visible = True
  426.     Line2.Visible = True
  427.     Line3.Visible = True
  428.     Line4.Visible = True
  429.     Label1.Visible = False
  430.     box1.Caption = ""
  431.     box2.Caption = ""
  432.     box3.Caption = ""
  433.     box4.Caption = ""
  434.     box5.Caption = ""
  435.     box6.Caption = ""
  436.     box7.Caption = ""
  437.     box8.Caption = ""
  438.     box9.Caption = ""
  439. End Sub
  440. Private Sub Label4_Click()
  441. End Sub
  442. Private Sub Timer1_Timer()
  443. If box1.Caption = "X" Then box1.ForeColor = &HFF&
  444. If box2.Caption = "X" Then box2.ForeColor = &HFF&
  445. If box3.Caption = "X" Then box3.ForeColor = &HFF&
  446. If box4.Caption = "X" Then box4.ForeColor = &HFF&
  447. If box5.Caption = "X" Then box5.ForeColor = &HFF&
  448. If box6.Caption = "X" Then box6.ForeColor = &HFF&
  449. If box7.Caption = "X" Then box7.ForeColor = &HFF&
  450. If box8.Caption = "X" Then box8.ForeColor = &HFF&
  451. If box9.Caption = "X" Then box9.ForeColor = &HFF&
  452. If box1.Caption = "O" Then box1.ForeColor = &HFF0000
  453. If box2.Caption = "O" Then box2.ForeColor = &HFF0000
  454. If box3.Caption = "O" Then box3.ForeColor = &HFF0000
  455. If box4.Caption = "O" Then box4.ForeColor = &HFF0000
  456. If box5.Caption = "O" Then box5.ForeColor = &HFF0000
  457. If box6.Caption = "O" Then box6.ForeColor = &HFF0000
  458. If box7.Caption = "O" Then box7.ForeColor = &HFF0000
  459. If box8.Caption = "O" Then box8.ForeColor = &HFF0000
  460. If box9.Caption = "O" Then box9.ForeColor = &HFF0000
  461. '***************************** X's ***********************************
  462. If box1.Caption = "X" And box2.Caption = "X" And box3.Caption = "X" Then
  463.     box4.Visible = False: box5.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  464.     player1points = player1points + 1
  465.     lblPlayer1points.Caption = player1points
  466.     Timer1.Interval = 0
  467.     Exit Sub
  468. End If
  469. If box4.Caption = "X" And box5.Caption = "X" And box6.Caption = "X" Then
  470.     box1.Visible = False: box2.Visible = False: box3.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  471.     player1points = player1points + 1
  472.     lblPlayer1points.Caption = player1points
  473.     Timer1.Interval = 0
  474.     Exit Sub
  475. End If
  476. If box7.Caption = "X" And box8.Caption = "X" And box9.Caption = "X" Then
  477.     box1.Visible = False: box2.Visible = False: box3.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False:
  478.     player1points = player1points + 1
  479.     lblPlayer1points.Caption = player1points
  480.     Timer1.Interval = 0
  481.     Exit Sub
  482. End If
  483. If box1.Caption = "X" And box5.Caption = "X" And box9.Caption = "X" Then
  484.     box2.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False:
  485.     player1points = player1points + 1
  486.     lblPlayer1points.Caption = player1points
  487.     Timer1.Interval = 0
  488.     Exit Sub
  489. End If
  490. If box3.Caption = "X" And box5.Caption = "X" And box7.Caption = "X" Then
  491.     box1.Visible = False: box4.Visible = False: box8.Visible = False: box9.Visible = False: box2.Visible = False: box6.Visible = False:
  492.     player1points = player1points + 1
  493.     lblPlayer1points.Caption = player1points
  494.     Timer1.Interval = 0
  495.     Exit Sub
  496. End If
  497. If box1.Caption = "X" And box4.Caption = "X" And box7.Caption = "X" Then
  498.     box2.Visible = False: box3.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False: box9.Visible = False:
  499.     player1points = player1points + 1
  500.     lblPlayer1points.Caption = player1points
  501.     Timer1.Interval = 0
  502.     Exit Sub
  503. End If
  504. If box2.Caption = "X" And box5.Caption = "X" And box8.Caption = "X" Then
  505.     box1.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box9.Visible = False:
  506.     player1points = player1points + 1
  507.     lblPlayer1points.Caption = player1points
  508.     Timer1.Interval = 0
  509.     Exit Sub
  510. End If
  511. If box3.Caption = "X" And box6.Caption = "X" And box9.Caption = "X" Then
  512.     box1.Visible = False: box4.Visible = False: box7.Visible = False: box2.Visible = False: box5.Visible = False: box8.Visible = False:
  513.     player1points = player1points + 1
  514.     lblPlayer1points.Caption = player1points
  515.     Timer1.Interval = 0
  516.     Exit Sub
  517. End If
  518. If box1.Caption = "X" And box3.Caption = "X" And box7.Caption = "X" And box9.Caption = "X" Then
  519.     box2.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False
  520.     player1points = player1points + 1
  521.     lblPlayer1points.Caption = player1points
  522.     Timer1.Interval = 0
  523.     Exit Sub
  524. End If
  525. '***************************** O's ***********************************
  526. If box1.Caption = "O" And box2.Caption = "O" And box3.Caption = "O" Then
  527.     box4.Visible = False: box5.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  528.     player2points = player2points + 1
  529.     lblPlayer2points.Caption = player2points
  530.     Timer1.Interval = 0
  531.     Exit Sub
  532. End If
  533. If box4.Caption = "O" And box5.Caption = "O" And box6.Caption = "O" Then
  534.     box1.Visible = False: box2.Visible = False: box3.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  535.     player2points = player2points + 1
  536.     lblPlayer2points.Caption = player2points
  537.     Timer1.Interval = 0
  538.     Exit Sub
  539. End If
  540. If box7.Caption = "O" And box8.Caption = "O" And box9.Caption = "O" Then
  541.     box1.Visible = False: box2.Visible = False: box3.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False:
  542.     player2points = player2points + 1
  543.     lblPlayer2points.Caption = player2points
  544.     Timer1.Interval = 0
  545.     Exit Sub
  546. End If
  547. If box1.Caption = "O" And box5.Caption = "O" And box9.Caption = "O" Then
  548.     box2.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False:
  549.     player2points = player2points + 1
  550.     lblPlayer2points.Caption = player2points
  551.     Timer1.Interval = 0
  552.     Exit Sub
  553. End If
  554. If box3.Caption = "O" And box5.Caption = "O" And box7.Caption = "O" Then
  555.     box1.Visible = False: box4.Visible = False: box8.Visible = False: box9.Visible = False: box2.Visible = False: box6.Visible = False:
  556.     player2points = player2points + 1
  557.     lblPlayer2points.Caption = player2points
  558.     Timer1.Interval = 0
  559.     Exit Sub
  560. End If
  561. If box1.Caption = "O" And box4.Caption = "O" And box7.Caption = "O" Then
  562.     box2.Visible = False: box3.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False: box9.Visible = False:
  563.     player2points = player2points + 1
  564.     lblPlayer2points.Caption = player2points
  565.     Timer1.Interval = 0
  566.     Exit Sub
  567. End If
  568. If box2.Caption = "O" And box5.Caption = "O" And box8.Caption = "O" Then
  569.     box1.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box9.Visible = False:
  570.     player2points = player2points + 1
  571.     lblPlayer2points.Caption = player2points
  572.     Timer1.Interval = 0
  573.     Exit Sub
  574. End If
  575. If box3.Caption = "O" And box6.Caption = "O" And box9.Caption = "O" Then
  576.     box1.Visible = False: box4.Visible = False: box7.Visible = False: box2.Visible = False: box5.Visible = False: box8.Visible = False:
  577.     player2points = player2points + 1
  578.     lblPlayer2points.Caption = player2points
  579.     Timer1.Interval = 0
  580.     Exit Sub
  581. End If
  582. If box1.Caption = "O" And box3.Caption = "O" And box7.Caption = "O" And box9.Caption = "O" Then
  583.     box2.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False
  584.     player2points = player2points + 1
  585.     lblPlayer2points.Caption = player2points
  586.     Timer1.Interval = 0
  587.     Exit Sub
  588. End If
  589. If box1.Caption <> "" And box2.Caption <> "" And box3.Caption <> "" And box4.Caption <> "" And box5.Caption <> "" And box6.Caption <> "" And box7.Caption <> "" And box8.Caption <> "" And box9.Caption <> "" Then
  590.     box1.Visible = False
  591.     box2.Visible = False
  592.     box3.Visible = False
  593.     box4.Visible = False
  594.     box5.Visible = False
  595.     box6.Visible = False
  596.     box7.Visible = False
  597.     box8.Visible = False
  598.     box9.Visible = False
  599.     Line1.Visible = False
  600.     Line2.Visible = False
  601.     Line3.Visible = False
  602.     Line4.Visible = False
  603.     Label1.Visible = True
  604. End If
  605. End Sub
  606.